Integrated color interpolation and color space conversion algorithm from 8-bit Bayer pattern RGB color space to 12-bit YCrCb color space

ABSTRACT

An integrated color interpolation and color space conversion technique and apparatus. A raw image that is arranged in a Bayer pattern where each pixel has only one of the color components needed to form a full color resolution pixel may be converted using this technique directly to a YCrCb image space without any intermediate conversion or interpolation steps. Specifically, in one instance, an 8-bit Bayer pattern raw image may be converted directly to a 12-bit YCrCb space in a single step approach. Such an integrated technique may more readily and inexpensively implemented in hardware such as on a digital camera, or in software.

This is a divisional of application Ser. No. 09/034,625, filed on Mar. 4, 1998, the priority of which is hereby claimed.

COPYRIGHT NOTICE

Contained herein is material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction of the patent disclosure by any person, as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all rights to the copyright whatsoever.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates generally to the field of graphics. More specifically, the invention relates to the field of digital imaging systems and software.

2. Description of the Related Art

In some digital cameras and imaging devices, the color information of a scene is captured by sub-sampling an image typically into three (Red, Green and Blue) color planes. In such cases, the original “raw image” is captured with each “raw image pixel” composed of only one of three vital color/intensity components: either R, G, or B (Red, Green, or Blue). But for image rendering devices (such as a monitor or printer), full color resolution, wherein each pixel is composed of a combination of R, G and B components, components, is desirable. Recovery of full color information from a sub-sampled image of single-color component raw image pixels is popularly known as color interpolation.

This is a continuation of application Ser. No. 09/034,625, filed on Mar. 4, 1998, that is currently pending. The following description refers to raw image pixels as either “pixels” or “raw image pixels”. Pixels that are formed by virtue of a completed color interpolation technique will be referred to as “full color pixels”. In digital still and video cameras and certain other imaging devices, raw images are first represented as rectangular row and column of pixels with each pixel having the intensity value of a particular color plane only. In the case of RGB (Red, Green and Blue) sub-sampling imaging devices, images are obtained and stored in a particular pattern. FIG. 1( a) shows are such pattern, which is considered in describing the invention, known as the “Bayer” pattern. The Bayer pattern (see FIG. 1( a)), when three color planes are sub-sampled, is characterized by including on a first row of an image, alternating pixels of Red and Green, and then on a next row alternating pixels of Blue and Green. Thus, the Bayer pattern for the first four rows of pixels (with each pixel typically an 8-bit value) is as follows (with the rows thereafter repeating the same pattern):

G R G R G R . . . B G B G B G . . . G R G R G R . . . B G B G B G . . .         .         .         .

As a result, each pixel location contains a value for a single color only. Assuming, as is the case in some imaging devices, that each pixel of the Bayer pattern has 8 bits of resolution (i.e., the pixel is a value representing the intensity of the color ranging from 0–255), then a “full color” pixel, one having R, G and B components would be a 24-bit value. To recover the two missing color components for each pixel, various methods of color interpolation or color recovery have been employed.

In color interpolation, an attempt is made to combine in some fashion neighboring pixel(s) to reconstruct, recover, or predict missing color component information for a given raw image pixel. Several prior art interpolation methods are described in “Interactions Between Color Plane Interpolation and Other Image Processing Functions in Electronic Photography”, James E. Adams, Jr., SPIE, (The International Society for Optical Engineering), Vol. 2416 (Electronic Imaging '95), pages 144–155 (July 1995), with most of these employing pixel averaging techniques to recover missing color components. At its simplest, a prior art averaging technique would interpolate the Red component of the captured Green pixel at row 2, column 2, (referring to the 8-bit Bayer pattern above) as the average of the two nearest red pixels, i.e., Red pixel at row 1, column 2 and the Red pixel at row 3, column 2. Likewise, the Blue component of the same captured Green at row 2, column 2 would be interpolated under an averaging technique as the average of the two nearest Blue pixels, i.e., the pixel at row 2, column 1 and the Blue pixel at row 2, column 3. The Blue and Red interpolated components are then combined with the original captured Green value of the pixel, row 2, column 2 to form a new pixel which is a composite “full” color pixel. The resultant “RGB” full color pixel is an approximation or prediction of the original object's true color at that location in the captured scene. FIG. 1( a) illustrates that to store the color interpolated image, three times the memory size of the original Bayer pattern image, would be required, assuming that each color plane component, R, G and B retains the same number of bits after interpolation.

Once each pixel of the image is at a full RGB color resolution (either through color interpolation or by virtue of having been captured at full color resolution), another process known as color space conversion may be performed. Depending on the rendering device or particular application for which the full color image is destined, the RGB “color space” (of an interpolated image, see FIG. 1( a)) may need to be converted. Certain imaging applications such as image editors or rendering devices such as printers do not use RGB color space in manipulating or rendering images. Instead they use different color spaces which may have the advantage of being more standardized or smaller in size. The RGB color space primarily indicates the levels of R, G and B in a pixel location and thus is a measure of the spectrum. An RGB color space image such as one resulting from color interpolating a Bayer pattern image also has both “chrominance” and “luminance” information although this information is less apparent. Luminance refers generally to the level of brightness in an image or pixel, whereas chrominance refers to the hue or placement of color in the color spectrum and saturation or intensity of that hue. In an RGB image, the Green color plane associated pixels contain most of the luminance information while Blue and Red associated pixels contain most of the chrominance information. This is due partly to the response of the human eye to recognize hue variations in the color Green over the colors Red and Blue, which are more associated in the human vision system with brightness or luminance levels. While a fully color interpolated RGB color space is excellent at representing the colors in an image, it is also three times larger in size that the original Bayer pattern (assuming for example an 8-bit to 24-bit color interpolation). Further, in an RGB color space image, the amount of Green is equivalent to the amount Red and Blue, and thus chrominance information may not be adequately represented. For these and other reasons, a color space known as YCrCb was developed.

YCrCb is a digital color system defined by the CCIR (International Consultative Committee on Broadcasting) and is also referred to as the CCIR 601 color space. YCrCb defines color images information in terms of luminance (Y component) and two different chrominance values (Cr—chrominance of Red colors and Cb—chrominance of Blue colors) rather than as a combination of the spectrum like the RGB space. When each pixel is thus represented, unlike the RGB color space where each pixel typically has 24 bits of information (8 bits for each color plane), each pixel can be represented by only 12 bits. This process is more fully described below, but requires an intermediate step where each first pixel has 24-bit YCrCb information and then is decimated to reduce the set to 12-bit values on the average. FIG. 1( b) illustrates the processing step where the 24-bit RGB space is converted into a 24-bit YCrCb space. As seen in FIG. 1( b), the prior art necessitates using a storage array three times the size of the 8-bit Bayer pattern original image. After the 24-bit YCrCb color space is obtained, every other pixel of Cr and Cb components must be decimated row wise and column wise such that only one in four pixels still has all three components. The other three pixels out of four have only the Y component in the 12-bit (so called because the pixels on average have 12-bits of information) YCrCb space. FIG. 1( c) shows this transformation.

Traditionally, the process of color interpolation and color space conversion have been independently performed. First, a raw image is color interpolated. When it is stored or transferred it may also be first compressed or encoded. The process of color space conversion ordinarily occurs in software or in application separate from the imaging system performing the image capture. Often, even color interpolation is performed in software. If performed in hardware, for instance, on a digital camera device, the process of color interpolation would demand a storage array of 24-bits multiplied by the size (number of rows and columns of pixels) of the image.

Color interpolation and color space conversion also both involve a set of computations. In the case of color interpolation, these computations may constitute equal-weight averaging, according to one traditional color interpolation technique, of neighboring raw image pixels. In the case of color space conversion a transformation matrix is utilized to convert each pixel from an RGB color space value to a YCrCb value. This transformation matrix usually consists of nine values determined by a 3×3 conversion matrix. After this transformation matrix is applied, the YCrCb values are decimated to reduce the final image to an average of 12 bits.

It would be desirable to design and provide a technique that integrates the operation of color interpolation and color space conversion into a single operation. Such a technique is advantageous in that a smaller storage array size, one sufficient to hold the 12-bit YCrCb information, rather than the full 24-bit RGB and 24-bit YCrCb information, could be implemented. Further, in a digital camera where color interpolation is performed on-camera, it may be desirable to also perform color space conversion in an integrated manner so that the overall computational complexity and time, as well as image memory size can all be reduced.

SUMMARY OF THE INVENTION

What is disclosed is a method including the steps of: (1) providing an integrated color space conversion and color interpolation technique, and (2) applying that technique to pixels of a raw image, the raw image pixels without full color resolution, the technique generating therefrom a color interpolated image in a different color space.

BRIEF DESCRIPTION OF THE DRAWINGS

The objects, features and advantages of the method and apparatus for the present invention will be apparent from the following description in which:

FIG. 1( a) shows 8-bit Bayer pattern RGB to 24-bit RGB conversion according to prior art.

FIG. 1( b) shows 24-bit RGB to 24-bit YCrCb conversion according to prior art.

FIG. 1( c) shows 24-bit YCrCb to 12-bit YCrCb conversion according to prior art.

FIG. 2 is a flow diagram describing the basic methodology and design basis for at least one embodiment of the invention.

FIG. 3 is a flow diagram according to one embodiment of the invention.

FIG. 4 illustrates the operation of the single pass integrated color space conversion and color interpolation technique.

FIG. 5 is a block diagram of an image processing apparatus according to an embodiment of the invention.

FIG. 6 is a system diagram of one embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

Referring to the figures, exemplary embodiments of the invention will now be described. The exemplary embodiments are provided to illustrate aspects of the invention and should not be construed as limiting the scope of the invention. The exemplary embodiments are primarily described with reference to block diagrams or flowcharts. As to the flowcharts, each block within the flowcharts represents both a method step and an apparatus element for performing the method step. Depending upon the implementation, the corresponding apparatus element may be configured in hardware, software, firmware or combinations thereof.

FIG. 2 is a flow diagram describing the basic methodology and design basis for at least one embodiment of the invention.

In imaging technology, there are many methods for color interpolation or recovery. When attempting to integrate the process of color space conversion with color interpolation, the color interpolation technique to be represented in the integrated technique should be compatible with the color space conversion process. One popular method of color interpolation is known as near neighbor averaging or linear filtering. In such a method, a missing color component for a given pixel location is determined by averaging the adjacent and/or neighboring pixels that are also associated with that missing color. Referring to the Bayer pattern of FIG. 1( a), the pixel location (0,1) (row,column) of the raw image has the value R01 which is a Red color plane value. In the Bayer pattern, the Green color plane component and Blue color plane components are missing for location (0,1). To interpolate the Green color component G′01, one method of color interpolation would average together adjacent Green color plane associated pixel values which are, for instance, G00, G11 and G02. Thus G′01 might be determined by computing (G00+G11+G02)/3. Likewise, the missing Blue color plane component B′01 (location (0,1) would be interpolated as the average of adjacent Blue color plane associated pixel values B10 and B12 or (B10+B12)/2. Linear averaging may also consider not only adjacent but neighboring pixels as well. Since there are many methods of color interpolation known in the art of imaging, a suitable one may be chosen for the application or implementation desired. Thus, according to step 210, in integrating color space conversion and color interpolation, a suitable color interpolation method should be determined. Then the interpolation method can be combined with a color space conversion technique (step 220).

For instance, when converting from RGB color space to the YCrCb color space, a set of conversion equations are defined such that for a given pixel location (i,j) each component Y, Cr and Cb is a linear combination of R, G and B components. One such set of equations is given below: Y _(i,j)=0.299*R _(i,j)+0.587*G _(i,j)+0.114*B _(i,j) Cr _(i,j)=−0.169*R _(i,j)−0.331*G _(i,j)+0.5*B _(i,j) or Cb _(i,j)=0.5*R _(i,j)−0.419*G _(i,j)−0.091*B _(i,j) $\begin{pmatrix} \begin{matrix} Y \\ {Cr} \end{matrix} \\ {Cb} \end{pmatrix} = {\begin{pmatrix} {\mspace{20mu} 0.299} & {\mspace{20mu} 0.587} & {\mspace{25mu} 0.114} \\ {- 0.169} & {- 0.331} & 0.5 \\ 0.5 & {- 0.419} & {\;{- 0.091}} \end{pmatrix}\begin{pmatrix} R \\ G \\ B \end{pmatrix}}$

This set of equations generates for every RGB value a corresponding YCrCb value for a given pixel location. Color space conversion may be achieved using other coefficients than those given above which are merely exemplary of one conversion matrix used in the art. The above equations for RGB to YCrCb conversion assumes that each pixel location already has a full color resolution, i.e., an R, G and B component. To progress from the CFA raw image directly to YCrCb, therefore, the color interpolation method chosen must be combined with color space conversion transform (step 220). If the same precision (i.e., number of bits) used to store the R, G and B values is used for the Y, Cr And Cb values, then the total size of the storage needed for the YCrCb image space would be the same. Thus, in an M by N image of 8-bit R, G and B values for each pixel, a total storage size of M*N*24 bits would be required. When this is converted to a full resolution YCrCb space, again the needed storage size would be M*N*24 bits (each pixel having 8 bit Y, Cr and Cb values).

In converting to the YCrCb color space, a further reduction is often performed to reduce the total storage size to M*N*12 bits. Hence, in this reduced form, the color space is referred to as a 12 bit YCrCb space. The integrated conversion described herein exemplifies application of the FIG. 2 methodology derive a technique to convert directly from an 8-bit per pixel raw image Bayer pattern (prior to color interpolation which yields 24-bit RGB values for each pixel). With an integrated technique, the need for a large storage array of M*N*24 bits is eliminated as is the complication of decimating a 24-bit YCrCb space into a 12-bit YCrCb space.

To combine color space conversion with color interpolation in this manner, a technique must be defined that combines the averaging of neighboring pixels for color interpolation and then converts and decimates simultaneously. The technique should be able to applied pixel-by-pixel (step 230) in a single pass method. Then, the 12-bit YCrCb values can be stored directly into array(s) pixel-by-pixel (step 240). Further as will be discussed below, since the values for each color plane are stored separately, the size of the Cr and Cb storage arrays may be defined/designed to be ¼ the size of the Y storage array. Thus, the integrated is advantageous in needing a smaller amount of storage.

FIG. 3 is a flow diagram according to one embodiment of the invention.

FIG. 3 shows that depending upon the row and column position of the pixel undergoing integrated conversion and interpolation, the formula or conversion algorithm employed will vary. This is due in large part to the repeating nature of the raw image in a Bayer pattern which has alternating rows and columns of pixels, each associated with certain color planes. Referring to FIG. 1( a), the first row of the Bayer pattern has pixels which in each column alternate between association with the Green and Red color planes. The next or second row of pixels alternate between the Blue and Green color planes. On the third row, the pattern is the same as the first row, and so on. When performing averaging-type color interpolation, both the number and location of neighboring pixels utilized to derive missing color components varies. Given a pixel Pij (or P_(i,j)), where “i” represents the row number and “j” the column number and P the color plane association of that location in the original raw image Bayer pattern, the location (i,j), which is determinative of what color plane component is already present in the raw image pixel, determines how to extract the averaging “set” i.e., the pixel values used in averaging.

For example, referring to FIG. 1( a), the Red color plane associated pixel R43 is missing Green and Blue color plane components. The Green component G′43 for the location (4,3) in the image array can be determined in a straightforward averaging-type linear interpolation as the average of Green neighbors G33, G42, G44 and G53. Thus, G′43=(G33+G42+G44+G53)/4. Likewise, the Blue component B′43 for the location (4,3) in the image array may be interpolated as B′43=(B32+B34+B54+B52)/4. In this manner, the three color plane components R, G and B, will form the pixel location (4,3) in the color interpolated RGB space image. The above determination can be generalized such that for any Red color plane associated pixel Rij in the raw image CFA, the interpolated components are B′ij=(B _(i−1,j−1) +B _(i−1,j+1) +B _(i+1,j+1) +B _(i+1,j−1))/4,and G′ij=(G _(i−1,j) +G _(i+1,j) +G _(i,j−1) +G _(i,j+1))/4.

Likewise, generalizations may be made for raw image pixels Bij and Gij such that: for Bij, G′ij=(G _(i−1,j) +G _(i+1,j) +G _(i,j−1) +G _(i,j+1))/4,and R′ij=(R _(i−1,j−1) +R _(i−1,j+1) +R _(i+1,j+1) +R _(i+1,j−1))/4.

For Gij, there are two possibilities. In a Bayer pattern CFA, Green associated pixels either accompany a row along with Red color plane associated pixels or Blue color plane associated pixels. This dichotomy can be translated in terms of the nature of the coefficients “i” and “j” themselves. When “i” and “j” are both odd, for each such Gij, B′ij=(B_(i,j−1)+B_(i,j+1))/2 and R′ij=(R_(i−1,j)+R_(i+1,j))/2. When “i” and “j” are both even, for each such Gij, B′ij=(B_(i−1,j)+B_(i+1,j))/2 and R′ij=(R_(i,j−1)+R_(i,j+1))/2.

Because Green color plane associated pixels actually represent chrominance information in the Bayer pattern, surrounding Green pixels are considered and an interpolation made even though the pixel is already Green. For any Green pixel, Gij, its Green component value is actually estimated/interpolated as: G′ij=G _(i−1,j−1) +G _(i−1,j+1)+4*G _(ij) +G _(i+1,j−1) +G _(i+1,j+1).

The above generalized equations will interpolate missing and Green color components for the raw image pixels arranged in the Bayer pattern. When the raw image is in some other pattern, the above equations may be easily modified as needed by one of ordinary skill in the art. These deterministic equations for color interpolation can be combined algebraically with the YCrCb color space conversion equations given above. Thus, for a location Rij in the CFA that already has a Red color plane associated component, Yij may be mapped as: Y _(i,j)=0.299R _(i,j)+0.14675(G _(i−1,j) +G _(i+1,j) +G _(i,j−1) +G _(i,j+1))+0.0285(B _(i−1,j−1) +B _(i−1,j+1) +B _(i+1,j−1) +B _(i+1,j+1)) This direct substitution into the 24-bit RGB (each pixel with all three components) to 24-bit YCrCb equations given above does not give an integrated solution in and of itself. The end result that the technique should achieve is a 12-bit YCrCb image space. To achieve this in the prior art, a procedure of decimation is applied wherein the Cr and Cb values are dropped in alternate rows and columns. As a result of this decimation, only one of every four pixels has full YCrCb information, while the other three pixels of the four retain only the Y component. If each component Y, Cr and Cb, have an 8-bit representation or precision, then three pixel locations out of four have 8 bits of information, while the fourth has a full 24 bits. The average number of bits for each pixel of those four is (8+8+8+24)/4 or 12 bits. When the 24-bit YCrCb space is decimated thus, it is known as a 12-bit YCrCb space not because each pixel has 12 bits of information but because each pixel has 12 bits on the average. This principle is further illustrated in FIG. 4.

One advantage of an integrated color interpolation and color space conversion technique is the ability to eliminate the need for decimation by considering only the relevant components during the technique. In so doing, decimation or the procedure of computing pixels that are only later to be discarded is avoided. This increases greatly the ability to deliver the converted image space quicker and in a more compute-efficient manner. When implemented in hardware, it further removes the need for the set of control circuitry that would be required to carry out decimation. Since there are in the original Bayer pattern image four different generalized equations for determining missing color components, the integrated technique is also split into four cases. Using algebraic substitution and disregarding components that would ordinarily undergo decimation, the following integrated technique may be obtained according to at least one embodiment of the invention:

(“Row Numbers” refers to the maximum row number, while “Column Number” refers to the maximum column number. In an M by N image, RowNumber=M while ColumnNumber=N.

-   begin     -   for (i=0 to RowNumber-1 && j=0 to ColumnNumber-1)         -   case 1 (i is even and j is odd):             Y _(i,j)=0.299R _(i,j)+0.14675(G _(i−1,j) +G _(i+1,j) +G             _(i,j −1) +G _(i,j+1))+0.0285(B _(i−1,j−1) +B _(i−1,j+1) +B             _(i+1,j−1) 30 B _(i+1,j+1))  [Formula 190 1]         -   case 2 (both i and j are even):             Y _(i,j)=0.1495(R _(i,j−1) +R _(i,j+1))+0.073375(G             _(i−1,j+1) +G _(i−1,j−1)+4G _(i,j) +G _(i−1,j−1) +G             _(i−1,j−1))+0.057(B _(i−1,j) +B _(i+1,j))  [Formula #2]         -   case 3 (i is odd and j is even):             Y _(i,j)=0.07475(R _(i−1,j−1) +R _(i−1,j+1) +R             _(i+1,j−1))+0.14675(G _(i−1,j) +G _(i+1,j) +G _(i,j−1) +G             _(i,j+1))+0.114B _(i,j)  [Formula #3]         -   case 4 (both i and j are odd):             Y _(i,j)=0.1495(R _(i−1,j) +R _(i+1,j))+0.073375(G             _(i−1,j−1) +G _(i−1,j+1)+4G _(i,j) +G _(i−1,j−1) +G             _(i+1,j+1))30 0.057(B _(i,j−1) +B _(i,j+1))  [Formula 190 4,             #5 and #6]             Cr _(i,j)=−0.0845(R _(i−1,j) +R _(i+1,j))−0.041375(G             _(i−1,j−1) +G _(i−1,j+1) +4G _(i,j) +G _(i+1,j−1) +G             _(i+1,j+1))+0.0250(B _(i,j−1) +B _(i,j+1))             Cb _(i,j)=0.250(R _(i−1,j) +R _(i+1,j))−0.052375(G             _(i−1,j−1) +G _(i−1,j+1)+4G _(i,j) +G _(i+1,j−1) +G             _(i+1,j+1))−0.0405(B _(i,j−1) +B _(i,j+1))     -   end for -   end.

The implementation of this four case technique is embodied in the flow diagram of FIG. 3. Due to the repeating nature of the Bayer pattern, the row and column position of the pixel location will indicate which of the four cases are applicable, and consequently, which formulas are to be utilized in determining the Y, Cr or Cb components as needed.

In implementing the above technique, the row and column position indicators, “i” and “j” respectively, are first initialized to zero (steps 305 and 310) and incremented thereafter as appropriate. The position (0,0) indicates the upper left most pixel location in the image array (see FIG. 1( a)). If “i” is odd (checked at step 315) and “j” is not odd, i.e., even (checked at steps 315 and 320, respectively) then only the Y component as determined in Formula #3 above is computed (step 340). If “i” is odd and “j” is odd (checked at steps 315 and 320, respectively), then all three components, Y, Cr and Cb must be determined. This represents the one pixel out of four in the resulting YCrCb image space that will have 24 bits (8 bits for each of three Y, Cr and Cb components). Thus, when “i” and “j” are both odd, Yij is determined according to Formula #4 (step 325). Additionally, in this case, Crij is determined according to Formula #5 (step 330) and Cbij is determined according to Formula #6 (step 335).

If “i” is not odd, but even (checked at step 315), and if “j” is odd (checked at step 345), then Yij is determined according to Formula #1 (step 355). If “i” is even and “j” is even, then Yij is determined according to Formula #2 (step 350). For pixels that have a row position and column position that is both odd, all three components—Y, Cr and Cb—are determined and for all other pixels, only the Y component is determined. This avoids the need for decimation since the values are computer/determined nor stored as they are in the prior art. Once the relevant component(s) for a pixel is/are determined, then the value(s) are stored into the appropriate image array (step 360). In one embodiment of the invention, the Y values are all stored in one array while the Cr and Cb values are stored in their own separate arrays. Since only one in four pixels has Cr and Cb components, those arrays are ¼ the size of the Y array, or ¼ the size as the raw image Bayer pattern (see FIG. 4).

Once the values are stored, “j” or the column position, is incremented. If the end of the row is reached (checked at step 370) then the row position “i” is incremented (step 380) provided that the row number will not have exceeded the maximum row number (checked at step 375). After the row position is incremented, the column position “j” is reset to zero (step 310). This resets the start of a new row. If the end of the row is not reached, then the current pixel location is processed. In this manner, a row by row scanning and processing of pixels is achieved. For each pixel location in the image array, a single-pass is sufficient to convert to a YCrCb space. This single integrated technique can be implemented in hardware, software, firmware or a combination thereof.

FIG. 4 illustrates the operation of the single pass integrated color space conversion and color interpolation technique. An 8-bit Bayer pattern (where each pixel location has only one 8-bit value associated either with R, G or B color planes) raw image can be directly transformed into a 12-bit YCrCb image using the integrated technique described according to various embodiments of the invention. All intermediate steps necessary in the prior art (see FIG. 1( a) through FIG. 1( c)) are eliminated. The size of the original Bayer pattern image is M rows by N columns multiplied by 8-bits. The 12-bit YCrCb image is peculiar in that only one in four pixels have all three components Y, Cr and Cb. The other pixels out of four have only the Y component. Assuming that each component has an 8-bit representation, this means that three pixels are 8-bits long and one pixel is 24 bits. This averages to 12-bits for the four pixels. Thus, the YCrCb space converted to is known as a 12-bit space.

This is further evident when the component planes, Y, Cr and Cb are considered separately. The Y plane is a full M*N*8-bits in size since each pixel has a Y component in the reduced component space. The Cr and Cb planes are each dimensions of M/2 by N/2. Thus, the total storage space required is M*N (for the Y component array), M*N/4 (for the Cr component array) and M*N/4 (for the Cb component array). Thus, a total of 3/2*M*N values need to be stored. Assuming that each value in the array is represented in 8-bits, the M*N image has 3/4*8 or 12 bits per pixel (average) in the M by N image array. Due to the repeated nature of the technique and of the original Bayer pattern, zero values for locations without Cr or Cb components do not need to be stored in the Cr and Cb component arrays, since the position of those values in the full image array is predetermined. For example, the first Cr array entry is Cr11 corresponding to position (1,1) in the image array when reconstituted. The value to its immediate right on the same row must be Cr13, since this is the next location in the full M*N array that has a Cr value. By translating the physical row and column position of values in the Cr and Cb arrays, the relative row and column position in the full size image array may be determined. Assume that (1,m) is the (row,column) position in the Cr and Cb arrays ranging from a value of 0 to M/2-1 for the row position and 0 to N/2-1 for the column position. Then (i,j), the position of the component in the full size array where “i” ranges from 0 to M-1 and “j” from 0 to N-1, maybe expressed as: i=l*2+1 j=m*2+1

By directly converting a Bayer pattern image into a YCrCb format, the many intermediate steps when color interpolation and color space conversion are performed separately are avoided. Further, as shown in FIG. 4, the corollary need to store M*N*24 bits of information for an M*N image is eliminated. In this integrated technique from a Bayer pattern image directly to a 12-bit YCrCb space image, the total image related storage needed is M*N*12 bits, which is ½ the storage needed in prior art techniques.

FIG. 5 is a block diagram of an image processing apparatus according to an embodiment of the invention.

FIG. 5 is a block diagram of internal image processing and compression components of an imaging device incorporating at least one embodiment of the invention. In the exemplary circuit of FIG. 5, a sensor 600 generates pixel components which are color/intensity values from some scene/environment. The 10-bit pixel values generated by sensor 600 are sent to a capture interface 610. Sensor 600 in the context relating to the invention will typically sense one of either R, G, or B components from one “sense” of an area or location. Thus, the intensity value of each pixel is associated with only one of three color planes and may form together a Bayer pattern such as that shown in FIG. 1( a). Capture interface 610 resolves the image generated by the sensor and assigns values to the individual pixels. The set of all such pixels for the entire image is in a Bayer pattern in accordance with at least one of the embodiments of the invention.

It is typical in any sensor device that some of the pixel cells in the sensor plane may not respond to the lighting condition in the scene/environment properly. As a result, the pixel values generated from these cell may be defective. These pixels are called “dead pixels.” The “pixel substitution” unit 615 replaces each dead pixel by the immediate previously valid pixel in the row.

A RAM table 616 consists of the row and column indices of the dead pixels, which are supplied by the sensor. This RAM table 616 helps to identify the location of dead pixels in relation to the captured image. Companding module 625 is circuit designed to convert each original pixel of 10-bit intensity captured from the sensor to an 8-bit intensity value. Companding module 625 is not needed if the sensor 600 and capture interface 610 provide an 8-bit per-pixel value.

According to at least one embodiment of the invention, as described above, the 8-bit value for each pixel may be directly converted (after companding) from its Bayer pattern single color component form (R, G and B) into a 12-bit YCrCb image space. This integrated technique may be implemented as hardware as shown in FIG. 5. An integrated color interpolation and color space conversion module 627 is coupled to companding module 625 and can receive therefrom 8-bit pixel data values. Each 8-bit value can be converted directly by module 627 into either Y, Cr, or Cb components as appropriate. Since the integrated technique envisions differing formulas depending on the position of the pixel in the image array, flip-flops and other-such state change mechanisms may be provided in module 627. A set of two flip-flops, one indicating row position and another indicating column position can be used to track whether a pixel lies on an even or odd row or column. Accordingly, these control signals and state signals may be used in selecting appropriate coefficients as specified by the formulas #1 through #6 described above. Also, RAM table 628 can be used to store coefficients for each formula or to store neighboring pixel values needed in executing the integrated technique. For example, formula #1 generates a Y component and only a Y component by utilizing 4 neighboring G color plane pixels and the input pixel Rij. As input pixels are received by module 627, they can be stored temporarily in RAM table 628 and flushed after the component(s) value has been utilized in the computation formulas for which they are required. Thus, module 627 will also consist of Read/Write logic that will facilitate the storage and retrieval of pixel values as desired. Further, add and multiply units can be provided in module 627 to carry out the necessary computations. For odd row, odd column pixels, module 627 will be designed to provide three sets of outputs (one for each Y, Cr and Cb component). These outputs which represent the 12-bit YCrCb converted image component values can be written to at least one image array(s) 630. As discussed above, the image array(s) 630 is at most M*N*12 bits in total capacity where M*N is the size of the captured image in rows and columns. By contrast, the prior art would have needed first a M*N*24 bit size image array capacity to perform intermediate conversion and interpolation steps (see FIGS. 1( a)–1(c)).

Further, the need to decimate a 24-bit YCrCb image space to attain a 12-bit YCrCb space would require additional circuitry and temporary storage of the entire image in 24-bit YCrCb form. In designing module 627, a RAM table 628 would need only to store, for each row of pixels being sensed and then converted, a maximum of two other rows of pixels.

A RAM table 626 may accompany companding module 625 and be used to look up, for each 10-bit value, a corresponding 8-bit mapped value. Thus, each pixel in the Bayer pattern will become an 8-bit value, associated with one of the three color planes.

Each of the RAM tables 616, 626 and 628 can directly communicate with bus 660 so that their data can be loaded and then later, if desired, modified. Further, those RAM tables and other RAM tables may be used to store scaled image data or intermediate result data as needed. Though the individual components (selectors, shifters, registers, add, multiply units and control/address signals) of module 627 have not been detailed, one skilled in the art will readily be able to implement such a device, following the logic of the flow diagram set forth in FIG. 3.

FIG. 6 is a system diagram of one embodiment of the invention.

Illustrated is a computer system 710, which may be any general or special purpose computing or data processing machine such as a PC (personal computer), coupled to a camera 730. Camera 730 may be a digital camera, digital video camera, or any image capture device or imaging system, or combination thereof and is utilized to capture an image of an object/scene 740. Essentially, captured images are processed by an image processing circuit 732 so that they can be efficiently stored in an image memory unit 734, which may be a ROM, RAM or other storage device such as a fixed disk. The image contained within image memory unit 734 that is destined for computer system 710 can be according to one embodiment of the invention, stored directly as a 12-bit YCrCb image space as opposed to an 24-bit color interpolated RGB image space. In most digital cameras that can perform still imaging, images are stored first and downloaded later. This allows the camera 730 to capture the next object/scene quickly without additional delay. The invention in its various embodiments, particularly in providing a 12-bit YCrCb image that is directly converted from the captured 8-bit Bayer pattern, reduces the storage requirements of the camera 730 and thus, the costs associated with that storage allowing for a more inexpensive camera. Further, in imaging applications where it is known a priori that YCrCb format is desired, such as in outputting the image to an analog signal rendering device (such as television), the image can be directly downloaded from camera 730 without modification or further processing.

The image processing circuit 732 carries out the integrated color interpolation and color space conversion directly from the Bayer pattern sense (with other intermediate steps such as pixel substitution or companding, see FIG. 5 and associated description) of camera 730 in this embodiment of the invention. When a color space converted and interpolated image is downloaded to computer system 710, it may be rendered to some output device such as a printer (not shown) or to a monitor device 720. If, according to one embodiment of the invention, the image is in 12-bit YCrCb format, it may need to be converted back to an RGB format. Conversion of the YCrCb image may be achieved using a processor 712 such as the Pentium® (a product of Intel Corporation) and a memory 711, such as RAM, which is used to store/load instruction addresses and result data.

In an alternate embodiment, the integrated color space conversion and color interpolation described above may be achieved in a software application running on computer system 710 rather than directly in camera 730. In such an embodiment, the image processing circuit may advantageously store only the 8-bit Bayer patter image. The application(s) used to perform the integrated color interpolation and color space conversion after download from camera 730 may be from an executable compiled from source code written in a language such as C++. The instructions of that executable file, which correspond with instructions necessary to scale the image, may be stored to a disk 718 or memory 711. Further, such application software may be distributed on a network or a computer-readable medium for use with other systems. It would be readily apparent to one of ordinary skill in the art to program a computing machine to perform integrated color space conversion and color interpolation an image if the methodology described above is followed. Further, the various embodiments of the invention may be implemented onto a video display adapter or graphics processing unit that provides color space conversion and color interpolation in an integrated single step as described above.

When an image, such as an image of a scene 740, is captured by camera 730, it is sent to the image processing circuit 732. Image processing circuit 732 consists of ICs and other components which execute, among other functions, the integrated color interpolation and color space conversion of an image. The scaling operation, as described earlier, may utilize image memory unit to store the original 12-bit YCrCb image space that results from the processing. Once all pixels are processed and transferred to the computer system 710 for rendering, the camera 730 is free to capture the next image. When the user or application desires/requests a download of images, the imaged stored in the image memory unit, whether stored as YCrCb images or as Bayer pattern images, are transferred from image memory unit 734 to the I/O port 717. I/O port uses the bus-bridge hierarchy shown (I/O bus 715 to bridge 714 to system bus 713) to temporarily store the YCrCb image data into memory 711 or, optionally, disk 718. Computer system 710 has a system bus 713 which facilitates information transfer to/from the processor 712 and memory 711 and a bridge 714 which couples to an I/O bus 715. I/O bus 715 connects various I/O devices such as a display adapter 716, disk 718 and an I/O port 717, such as a serial port. Many such combinations of I/O devices, buses and bridges can be utilized with the invention and the combination shown is merely illustrative of one such possible combination.

In one embodiment of the invention, the YCrCb images can converted back to full resolution RGB space on computer system 712 by suitable application software (or hardware), which may utilize processor 712 for its execution. The RGB image data may then be rendered visually using a display adapter 716 into a rendered/scaled image 750. Since color interpolation and color space conversion are readily facilitated on-camera in one embodiment of the invention, it may be possible to implement a communication port in camera 730 that allows the image data to be transported directly to the other devices such as an analog device that renders in YCrCb rather than in RGB.

In the foregoing specification, the invention has been described with reference to specific exemplary embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention as set forth in the appended claims. The specification and drawings are accordingly to be regarded as illustrative rather than restrictive. 

1. A method comprising: for each of the pixels in a Bayer pattern image, the Bayer pattern image having red, green, and blue pixels, determining a luminance value for the pixel directly from the Bayer pattern color values for pixels in the neighborhood of the Bayer pattern pixel; for at least some of the green pixels in the Bayer pattern image, determining a chrominance value for the respective green pixel directly from the Bayer pattern color values for pixels in the neighborhood of the respective green pixel; and mapping the luminance and chrominance values into a luminance and chrominance color space.
 2. A method according to claim 1 wherein said luminance and chrominance color space comprises a YCrCb image space.
 3. A method according to claim 1 wherein the neighborhood of a pixel includes the pixel.
 4. A method according to claim 1 wherein said Bayer pattern is defined in row and column positions and wherein said neighborhood of a pixel includes pixels positioned no more than one row or column position away from the pixel.
 5. A method according to claim 1 wherein determining said luminance value for a red Bayer pattern pixel location includes determining an average of the green Bayer pattern pixels in the neighborhood of the red Bayer pattern pixel, determining an average of the blue Bayer pattern pixels in the neighborhood of the red Bayer pattern pixel, weighting the averages and the red Bayer pattern pixel and adding the weighted averages and the red Bayer pattern pixel to obtain the luminance.
 6. A method according to claim 5 wherein determining said average of the green Bayer pattern pixels comprises averaging the four green Bayer pattern pixels nearest the red Bayer pattern pixel, and determining an average of the blue Bayer pattern pixels comprises averaging the four blue Bayer pattern pixels nearest the red Bayer pattern pixel.
 7. A method according to claim 1 wherein determining said luminance value for a blue Bayer pattern pixel location includes determining an average of the green Bayer pattern pixels in the neighborhood of the blue Bayer pattern pixel, determining an average of the red Bayer pattern pixels in the neighborhood of the blue Bayer pattern pixel, weighting the averages and the blue Bayer pattern pixel and adding the weighted averages and the blue Bayer pattern pixel to obtain the luminance.
 8. A method according to claim 7 wherein determining said average of the green Bayer pattern pixels comprises averaging the four green Bayer pattern pixels nearest the blue Bayer pattern pixel, and determining an average of the red Bayer pattern pixels comprises averaging the four red Bayer pattern pixels nearest the blue Bayer pattern pixel.
 9. A method according to claim 1 wherein determining said luminance value for a green Bayer pattern pixel location includes determining an average of the green Bayer pattern pixels in the neighborhood of the green Bayer pattern pixel, determining an average of the red Bayer pattern pixels in the neighborhood of the green Bayer pattern pixel, determining an average of the blue Bayer pattern pixels in the neighborhood of the green Bayer pattern pixel, weighting the averages, and adding the weighted averages to obtain the luminance.
 10. A method according to claim 9 wherein determining said average of the green Bayer pattern pixels comprises averaging the green Bayer pattern pixel with the four green Bayer pattern pixels nearest the green Bayer pattern pixel, determining said average of the red Bayer pattern pixels comprises averaging the four red Bayer pattern pixels nearest the green Bayer pattern pixel, and determining said average of the blue Bayer pattern pixels comprises averaging the four blue Bayer pattern pixels nearest the green Bayer pattern pixel.
 11. A method according to claim 1 wherein determining said chrominance value for a green Bayer pattern pixel location includes determining an average of the green Bayer pattern pixels in the neighborhood of the green Bayer pattern pixel, determining an average of the blue Bayer pattern pixels in the neighborhood of the green Bayer pattern pixels, determining an average of the red Bayer pattern pixels in the neighborhood of the green Bayer pattern pixel, weighting the averages and adding the weighted averages to obtain the chrominance.
 12. A method according to claim 11 wherein determining said average of the green Bayer pattern pixels comprises averaging the green Bayer pattern pixel with the four green Bayer pattern pixels nearest the green Bayer pattern pixel, determining said average of the blue Bayer pattern pixel comprises averaging the four blue Bayer pattern pixels nearest the green Bayer pattern pixel, and determining said average of the red Bayer pattern pixels comprises averaging the four red Bayer pattern pixels nearest the green Bayer pattern pixel.
 13. A method according to claim 1 wherein determining said luminance value for a pixel comprises using an average of the Bayer pattern color values for pixels in the neighborhood of the specific pixel.
 14. A method according to claim 1 wherein determining said chrominance value for at least some of the green pixels comprises using an average of the Bayer pattern color values for pixels in the neighborhood of the specific subset pixel.
 15. An apparatus comprising: a conversion module to convert a Bayer pattern of pixels into a chrominance and luminance color space by determining a luminance value for each of the pixels directly from the Bayer pattern color values for pixels in the neighborhood of each of the pixels and determining chrominance values for at least some of the green pixels directly from the Bayer pattern color values for pixels in the neighborhood of the respective green pixel; and a memory coupled to said module, said memory configured to store and provide pixel values required by said module during its operation.
 16. An apparatus according to claim 15 wherein said module is configured to convert the Bayer pattern input image into a 12-bit YCrCb image.
 17. An apparatus according to claim 15 wherein said memory comprises image arrays, said image arrays configured to store separately sets of Y, Cr and Cb components of the luminance and chrominance color space.
 18. An apparatus according to claim 15 to be embedded in a digital image capture device.
 19. An apparatus according to claim 15 to be tethered to a computer system, said computer system to download said luminance and chrominance color space image.
 20. An apparatus according to claim 15 wherein determining said luminance value comprises using an average of the Bayer pattern color values for pixels in the neighborhood of each of the pixels.
 21. An apparatus according to claim 15 wherein determining said chrominance values comprises using an average of the Bayer pattern color values for pixels in the neighborhood of the subset pixel.
 22. An apparatus comprising: a sensor to generate pixel components from a scene; a capture mechanism to resolve the pixel components generated by the sensor and assign values to individual pixels, wherein the pixels are arranged in a Bayer pattern; a pixel substitution unit to replace dead pixels with valid pixels; a conversion module to convert the Bayer pattern into a chrominance and luminance color space by determining a luminance value for each of the pixels directly from the Bayer pattern color values for pixels in the neighborhood of each of the pixels and determining chrominance values for a subset of the pixels directly from the color values for pixels in the neighborhood of the subset pixel; and a memory coupled to said module, said memory configured to store and provide pixel values required by said module during its operation.
 23. An apparatus according to claim 22 further comprising a companding module to convert the pixels from a larger number of bits per pixel to a smaller number of bits per pixel.
 24. An apparatus according to claim 22 wherein said memory comprises image arrays, said image arrays configured to store sets of Y, Cr and Cb components of the luminance and chrominance color space.
 25. An apparatus comprising: a processor; a system bus to transfer information to and from the processor; an I/O bus to transfer information to and from an I/O port; a bridge coupled to the system bus and the I/O bus; an image-processing circuit coupled to the I/O port to convert a Bayer pattern of pixels into a chrominance and luminance color space by determining a luminance value for each of the pixels directly from the Bayer pattern color values for pixels in the neighborhood of each of the pixels and by determining chrominance values for a subset of the pixels directly from the color values for pixels in the neighborhood of the subset pixel; an image memory unit coupled to the image-processing circuit, said memory configured to store and provide pixel values required by the image-processing circuit during its operation.
 26. An apparatus according to claim 25 further comprising an image capture mechanism coupled to said image-processing circuit to generate a scene in said Bayer pattern of pixels.
 27. An apparatus according to claim 25 wherein said module is configured to convert the Bayer pattern input image into a 12-bit YCrCb image.
 28. A machine readable-medium having stored thereon data representing sequences of instructions which, when executed by a processor, cause the processor to: for each of the pixels in a Bayer pattern image, the Bayer pattern image having red, green, and blue pixels, determine a luminance value for a specific pixel directly from the Bayer pattern color values for pixels in the neighborhood of the Bayer pattern pixel; for at least some of the green pixels in the Bayer pattern image, determine a chrominance value for the respective green pixel directly from the Bayer pattern color values for pixels in the neighborhood of the respective green pixel; and map the luminance and chrominance values into a luminance and chrominance color space.
 29. A machine-readable medium according to claim 28 wherein said luminance and chrominance color space comprises a YCrCb image space.
 30. A machine-readable medium according to claim 28 wherein said determine a luminance value comprises using an average of the Bayer pattern color values for pixels in the neighborhood of each of the pixels.
 31. A machine-readable medium according to claim 28 wherein said determine a chrominance value comprises using an average of the Bayer pattern color values for pixels in the neighborhood of the subset pixel. 